#!/usr/bin/env python

from dataclasses import dataclass, field
from logging import getLogger

logger = getLogger(__name__)


@dataclass
class CriticalFrameDetectorConfig:
    dataset_path: str | None = None
    gripper_config: list[int] | None = None
    clip_view: list[str] = field(default_factory=lambda: ["all"])
    min_current_threshold: float = 0.2
    max_velocity_threshold: float = 0.01
    key_frame_training_weight: float = 2
    n_forward_expansion: int = 50
    n_backward_expansion: int = 30

    def validate(self) -> None:
        if not self.dataset_path:
            raise ValueError(
                "dataset_path is not configured. Please specify a pretrained policy with `--dataset_path`."
            )
        if not self.gripper_config:
            raise ValueError(
                """gripper_config is not configured. Please specify a pretrained policy with `--gripper_config`."""
            )
